#!/sbin/openrc-run

command="python3"
command_args="/srv/http/manage.py start_tornado --host 127.0.0.1"
command_background="yes"
command_user="http"
pidfile="/tmp/tornado.pid"

depend() {
    need mariadb redis
}

start() {
    ebegin "Starting tornado"
    set -x
    start-stop-daemon --start \
            --user ${command_user}:${command_user} \
            --make-pidfile \
            --pidfile "${pidfile}" \
            --exec "${command}" \
            --background \
            --stdout /dev/stdout \
            --stderr /dev/stderr \
            -- ${command_args}
    eend $?
}
